package com.we.risk.phoneRecord.stage2.adm;

public class PhoneCallBasicInfo {
    public static final String NUMBER = "number";
    public static final String MOBPROV = "mobileprov";
    public static final String MOBCITY = "mobilecity";
    public static final String PIDPROV = "pidprov";
    public static final String PIDCITY = "pidcity";
    public static final String ADDRPROV = "addrprov";
    public static final String ADDRCITY = "addrcity";

    //    public PhoneCallBasicInfo() {
    //        call_days_set = new HashSet<>();
    //    }

    public double total_time = Double.valueOf("0");
    public int cnt = 0;

    /** final avg_time is Integer total_time/cnt is the source value in Double */
    public int avg_time = 0;

    public int days = 0;
    public int income_cnt = 0;
    public int outgo_cnt = 0;
    public int bad_cnt = 0;
    public int time0_cnt = 0;
    public int time10_cnt = 0;
    public int time60_cnt = 0;
    public int bemorning_cnt = 0;
    public int morning_cnt = 0;
    public int afternoon_cnt = 0;
    public int night_cnt = 0;
    //    public Set<String> call_days_set;
    /** 通话记录是否和用户注册手机、pid、addr相同 */
    public byte mobile_prov = 0;

    public byte mobile_city = 0;
    public byte pid_prov = 0;
    public byte pid_city = 0;
    public byte addr_prov = 0;
    public byte addr_city = 0;

    public double score = Double.valueOf("0");
    public int score_label = 0;

    public double getAvg_time() {
        return total_time / cnt;
    }

    public double getTotal_time() {
        return total_time;
    }

    public byte getMobile_prov() {
        return mobile_prov;
    }

    public byte getMobile_city() {
        return mobile_city;
    }

    public byte getPid_prov() {
        return pid_prov;
    }

    public byte getPid_city() {
        return pid_city;
    }

    public byte getAddr_prov() {
        return addr_prov;
    }

    public byte getAddr_city() {
        return addr_city;
    }

    public int getDays() {
        return days;
    }

    public int getCnt() {
        return cnt;
    }

    public int getScore_label() {
        return score_label;
    }

    public int getIncome_cnt() {
        return income_cnt;
    }

    public int getOutgo_cnt() {
        return outgo_cnt;
    }

    public int getBad_cnt() {
        return bad_cnt;
    }

    public int getTime0_cnt() {
        return time0_cnt;
    }

    public int getTime10_cnt() {
        return time10_cnt;
    }

    public int getTime60_cnt() {
        return time60_cnt;
    }

    public int getBemorning_cnt() {
        return bemorning_cnt;
    }

    public int getMorning_cnt() {
        return morning_cnt;
    }

    public int getAfternoon_cnt() {
        return afternoon_cnt;
    }

    public int getNight_cnt() {
        return night_cnt;
    }

    public void formattedDetailData() {
        formatCallAvgTime();
        formatCallTotalTime();
        formatCallCnt();
        formatCallIncomeCnt();
        formatCallOutgoCnt();
        formatCallBadCnt();
        formatCallTime0Cnt();
        formatCallTime10Cnt();
        formatCallTime60Cnt();
        formatCallDays();
        formatScoreLabel();
    }

    private void formatCallAvgTime() {
        double tmp_avg_time = total_time / cnt;
        if (tmp_avg_time < 15) {
            avg_time = 1;
        } else if (tmp_avg_time < 30) {
            avg_time = 2;
        } else if (tmp_avg_time < 60) {
            avg_time = 3;
        } else if (tmp_avg_time >= 60) {
            avg_time = 4;
        }
    }

    public String getCallAvgTimeTag() {
        if (avg_time == 1) {
            return NUMBER + "1";
        } else if (avg_time == 2) {
            return NUMBER + "2";
        } else if (avg_time == 3) {
            return NUMBER + "3";
        } else if (avg_time == 4) {
            return NUMBER + "4";
        }
        return "null";
    }

    private void formatCallTotalTime() {
        if (total_time < 150) {
            total_time = 1;
        } else if (total_time < 1600) {
            total_time = 2;
        } else if (total_time < 7200) {
            total_time = 3;
        } else if (total_time >= 7200) {
            total_time = 4;
        }
    }

    public String getCallTotalTimeTag() {
        if (total_time == 1) {
            return NUMBER + "5";
        } else if (total_time == 2) {
            return NUMBER + "6";
        } else if (total_time == 3) {
            return NUMBER + "7";
        } else if (total_time == 4) {
            return NUMBER + "8";
        }
        return "null";
    }

    private void formatCallCnt() {
        if (cnt < 5) {
            cnt = 1;
        } else if (cnt < 35) {
            cnt = 2;
        } else if (cnt < 140) {
            cnt = 3;
        } else if (cnt >= 140) {
            cnt = 4;
        }
    }

    public String getCallCntTag() {
        if (cnt == 1) {
            return NUMBER + "9";
        } else if (cnt == 2) {
            return NUMBER + "10";
        } else if (cnt == 3) {
            return NUMBER + "11";
        } else if (cnt == 4) {
            return NUMBER + "12";
        }
        return "null";
    }

    private void formatCallIncomeCnt() {
        if (income_cnt < 1) {
            income_cnt = 1;
        } else if (income_cnt < 10) {
            income_cnt = 2;
        } else if (income_cnt < 50) {
            income_cnt = 3;
        } else if (income_cnt >= 50) {
            income_cnt = 4;
        }
    }

    public String getIncomeCntTag() {
        if (income_cnt == 1) {
            return NUMBER + "13";
        } else if (income_cnt == 2) {
            return NUMBER + "14";
        } else if (income_cnt == 3) {
            return NUMBER + "15";
        } else if (income_cnt == 4) {
            return NUMBER + "16";
        }
        return "null";
    }

    private void formatCallOutgoCnt() {
        if (outgo_cnt < 2) {
            outgo_cnt = 1;
        } else if (outgo_cnt < 16) {
            outgo_cnt = 2;
        } else if (outgo_cnt < 70) {
            outgo_cnt = 3;
        } else if (outgo_cnt >= 70) {
            outgo_cnt = 4;
        }
    }

    public String getOutgoCntTag() {
        if (outgo_cnt == 1) {
            return NUMBER + "17";
        } else if (outgo_cnt == 2) {
            return NUMBER + "18";
        } else if (outgo_cnt == 3) {
            return NUMBER + "19";
        } else if (outgo_cnt == 4) {
            return NUMBER + "20";
        }
        return "null";
    }

    private void formatCallBadCnt() {
        if (bad_cnt < 1) {
            bad_cnt = 1;
        } else if (bad_cnt < 2) {
            bad_cnt = 2;
        } else if (bad_cnt < 10) {
            bad_cnt = 3;
        } else if (bad_cnt >= 10) {
            bad_cnt = 4;
        }
    }

    public String getBadCntTag() {
        if (bad_cnt == 1) {
            return NUMBER + "21";
        } else if (bad_cnt == 2) {
            return NUMBER + "22";
        } else if (bad_cnt == 3) {
            return NUMBER + "23";
        } else if (bad_cnt == 4) {
            return NUMBER + "24";
        }
        return "null";
    }

    private void formatCallTime0Cnt() {
        if (time0_cnt < 1) {
            time0_cnt = 1;
        } else if (time0_cnt < 6) {
            time0_cnt = 2;
        } else if (time0_cnt < 25) {
            time0_cnt = 3;
        } else if (time0_cnt >= 25) {
            time0_cnt = 4;
        }
    }

    public String getTime0CntTag() {
        if (time0_cnt == 1) {
            return NUMBER + "25";
        } else if (time0_cnt == 2) {
            return NUMBER + "26";
        } else if (time0_cnt == 3) {
            return NUMBER + "27";
        } else if (time0_cnt == 4) {
            return NUMBER + "28";
        }
        return "null";
    }

    private void formatCallTime10Cnt() {
        if (time10_cnt < 1) {
            time10_cnt = 1;
        } else if (time10_cnt < 10) {
            time10_cnt = 2;
        } else if (time10_cnt < 35) {
            time10_cnt = 3;
        } else if (time10_cnt >= 35) {
            time10_cnt = 4;
        }
    }

    public String getTime10CntTag() {
        if (time10_cnt == 1) {
            return NUMBER + "29";
        } else if (time10_cnt == 2) {
            return NUMBER + "30";
        } else if (time10_cnt == 3) {
            return NUMBER + "31";
        } else if (time10_cnt == 4) {
            return NUMBER + "32";
        }
        return "null";
    }

    private void formatCallTime60Cnt() {
        if (time60_cnt < 1) {
            time60_cnt = 1;
        } else if (time60_cnt < 6) {
            time60_cnt = 2;
        } else if (time60_cnt < 28) {
            time60_cnt = 3;
        } else if (time60_cnt >= 28) {
            time60_cnt = 4;
        }
    }

    public String getTime60CntTag() {
        if (time60_cnt == 1) {
            return NUMBER + "33";
        } else if (time60_cnt == 2) {
            return NUMBER + "34";
        } else if (time60_cnt == 3) {
            return NUMBER + "35";
        } else if (time60_cnt == 4) {
            return NUMBER + "36";
        }
        return "null";
    }

    private void formatCallDays() {
        //        days = call_days_set.size();
        if (days < 2) {
            days = 1;
        } else {
            days = 2;
        }
    }

    public String getCallDaysTag() {
        if (days == 1) {
            return NUMBER + "37";
        } else {
            return NUMBER + "38";
        }
    }

    private void formatScoreLabel() {
        if (score < 0.287117026869125) {
            score_label = 0;
        } else if (score < 0.517248231087952) {
            score_label = 1;
        } else if (score < 0.728873660972127) {
            score_label = 2;
        } else if (score < 0.809931230286806) {
            score_label = 3;
        } else if (score < 1) {
            score_label = 4;
        }
    }

    public String getScoreTag() {
        if (score_label == 0) {
            return NUMBER + "39";
        } else if (score_label == 1) {
            return NUMBER + "40";
        } else if (score_label == 2) {
            return NUMBER + "41";
        } else if (score_label == 3) {
            return NUMBER + "42";
        } else if (score_label == 4) {
            return NUMBER + "43";
        }
        return "null";
    }

    public String getMobProvTag() {
        if (mobile_prov == 1) {
            return MOBPROV + 1;
        } else {
            return MOBPROV + 0;
        }
    }

    public String getMobCityTag() {
        if (mobile_city == 1) {
            return MOBCITY + 1;
        } else {
            return MOBCITY + 0;
        }
    }

    public String getPidProvTag() {
        if (pid_prov == 1) {
            return PIDPROV + 1;
        } else {
            return PIDPROV + 0;
        }
    }

    public String getPidCityTag() {
        if (pid_city == 1) {
            return PIDCITY + 1;
        } else {
            return PIDCITY + 0;
        }
    }

    public String getAddrProvTag() {
        if (addr_prov == 1) {
            return ADDRPROV + 1;
        } else {
            return ADDRPROV + 0;
        }
    }

    public String getAddrCityTag() {
        if (addr_city == 1) {
            return ADDRCITY + 1;
        } else {
            return ADDRCITY + 0;
        }
    }

    @Override
    public String toString() {
        return "PhoneCallBasicInfo{"
                + "total_time="
                + total_time
                + ", cnt="
                + cnt
                + ", avg_time="
                + avg_time
                + ", days="
                + days
                + ", income_cnt="
                + income_cnt
                + ", outgo_cnt="
                + outgo_cnt
                + ", bad_cnt="
                + bad_cnt
                + ", time0_cnt="
                + time0_cnt
                + ", time10_cnt="
                + time10_cnt
                + ", time60_cnt="
                + time60_cnt
                + ", bemorning_cnt="
                + bemorning_cnt
                + ", morning_cnt="
                + morning_cnt
                + ", afternoon_cnt="
                + afternoon_cnt
                + ", night_cnt="
                + night_cnt
                + ", mobile_prov="
                + mobile_prov
                + ", mobile_city="
                + mobile_city
                + ", pid_prov="
                + pid_prov
                + ", pid_city="
                + pid_city
                + ", addr_prov="
                + addr_prov
                + ", addr_city="
                + addr_city
                + ", score="
                + score
                + ", call_days: "
                + getCallDaysTag()
                + ", score_label="
                + score_label
                + '}';
    }
}
